#include "application.h"
#include <extensions/context.h>
#include <extensions/mainwindow.h>

namespace Optra {

namespace Extensions{


class ApplicationPrivate{
public:
    ApplicationPrivate():mainWindow(0)
      ,mainItem(0){}
    ~ApplicationPrivate() { delete mainWindow; delete mainItem; }
    MainWindow* mainWindow;
    QDeclarativeItem* mainItem;
};

Application::Application():
O_PRIVATE_CREATE(Application){

}

Application::Application(const ContextPtr& ctx, Opl::Core::EntityObject *parent/* = 0*/) :
    Plugin(Plugin::application, ctx, parent), O_PRIVATE_CREATE(Application)
{
    O_D(Application);
    setArea(Plugin::Gui);
    //d->
}

Application::~Application()
{
    O_PRIVATE_DELETE;
}

void Application::setMainItem(QDeclarativeItem* wnd)
{
    O_D(Application);
    d->mainItem = wnd;
}

QDeclarativeItem* Application::mainItem()const
{
    O_C(Application);
    return d->mainItem;
}

void Application::setMainWindow(MainWindow* wnd)
{
    O_D(Application);
    d->mainWindow = wnd;
}

MainWindow* Application::mainWindow()const
{
    O_C(Application);
    return d->mainWindow;
}

void Application::Setup(Type type, const Optra::Extensions::ContextPtr& ctx)
{
    Plugin::Setup(type, ctx);
}

}}
